n=int(input())
x=list(map(int, input().split()))
x.reverse()
p=x.index(0)
q=x.index(1)
if p>q:
r=n-p
else:
r=n-q
print(r)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,l=0,r=0,j,ra,la;
cin>>n;
int a[n];
for(int i=1;i<=n;i++){
cin>>a[i];
}
for(int i=1;i<=n;i++){
if(a[i]==0)
l++;
else
r++;
}
ra=r;
la=l;
for(j=1;j<=n;j++){
if(a[j]==0)
la--;
else
ra--;
if(la==0||ra==0)
break;
}
cout<<j;
return 0;
}
Back to School | I am Easy |
Teddy and Tweety | Partitioning binary strings |
Special sets | Smallest chosen word |
Going to office | Color the boxes |
Missing numbers | Maximum sum |
13 Reasons Why | Friend's Relationship |
Health of a person | Divisibility |
A. Movement | Numbers in a matrix |
Sequences | Split houses |
Divisible | Three primes |
Coprimes | Cost of balloons |
One String No Trouble | Help Jarvis! |
Lift queries | Goki and his breakup |
Ali and Helping innocent people | Book of Potion making |
Duration | Birthday Party |